﻿using Shop.RemoteModel.FrontCategory;
using Shop.RemoteModel.FrontCategory.Model;
using Shop.StoreGatewayModular.Interface;

namespace Shop.StoreGatewayModular.Service
{
    internal class FrontCategoryService : IFrontCategoryService
    {
        public long Add (FrontCategoryAdd add)
        {
            return new AddFrontCategory
            {
                Datum = add
            }.Send();
        }
        public void Delete (long id)
        {
            new DeleteFrontCategory
            {
                Id = id
            }.Send();
        }
        public void Disable (long id)
        {
            new DisableFrontCategory
            {
                Id = id
            }.Send();
        }
        public void Enable (long id)
        {
            new EnableFrontCategory
            {
                Id = id
            }.Send();
        }
        public FrontCategoryDatum Get (long id)
        {
            return new GetFrontCategory
            {
                Id = id
            }.Send();
        }
        public FrontCategoryFullTree[] GetFullTree ()
        {
            return new GetFrontCategoryFullTree().Send();
        }
        public FrontCategoryTree[] GetTree (FrontCategoryGetParam param)
        {
            return new GetFrontCategoryTree
            {
                Query = param
            }.Send();
        }
        public void Move (long id, long? toId)
        {
            new MoveFrontCategory
            {
                Id = id,
                ToId = toId
            }.Send();
        }
        public bool Set (long id, FrontCategorySet datum)
        {
            return new SetFrontCategory
            {
                Id = id,
                Datum = datum
            }.Send();
        }
        public Dictionary<long, int> SetSort (long id, int sort)
        {
            return new SetFrontCategorySort
            {
                Id = id,
                Sort = sort
            }.Send();
        }
        public bool SetBind (long id, long[] categoryId)
        {
            return new SetFrontCategoryBind
            {
                CategoryId = categoryId,
                FrontId = id
            }.Send();
        }
    }
}
